<h1><code ng:non-bindable="">ngRepeat</code>
<span class="hint">(directive in module <code ng:non-bindable="">ng</code>
)</span>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/directive/ngRepeat.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>The <code>ngRepeat</code> directive instantiates a template once per item from a collection. Each template
instance gets its own scope, where the given loop variable is set to the current collection item,
and <code>$index</code> is set to the item index or key.</p>

<p>Special properties are exposed on the local scope of each template instance, including:</p>

<ul>
<li><code>$index</code> – <code>{number}</code> – iterator offset of the repeated element (0..length-1)</li>
<li><code>$first</code> – <code>{boolean}</code> – true if the repeated element is first in the iterator.</li>
<li><code>$middle</code> – <code>{boolean}</code> – true if the repeated element is between the first and last in the iterator.</li>
<li><code>$last</code> – <code>{boolean}</code> – true if the repeated element is last in the iterator.</li>
</ul></div>
<h2 id="Usage">Usage</h2>
<div class="usage">as attribute<pre class="prettyprint linenums">&lt;ANY ng-repeat="{repeat_expression}"&gt;
   ...
&lt;/ANY&gt;</pre>
as class<pre class="prettyprint linenums">&lt;ANY class="ng-repeat: {repeat_expression};"&gt;
   ...
&lt;/ANY&gt;</pre>
<h3 id="Directive.info">Directive info</h3>
<div class="directive-info"><ul><li>This directive creates new scope.</li>
<li>This directive executes at priority level 1000.</li>
</ul>
</div>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">ngRepeat – {repeat_expression} – </code>
<p>The expression indicating how to enumerate a collection. Two
formats are currently supported:</p>

<ul>
<li><p><code>variable in expression</code> – where variable is the user defined loop variable and <code>expression</code>
is a scope expression giving the collection to enumerate.</p>

<p>For example: <code>track in cd.tracks</code>.</p></li>
<li><p><code>(key, value) in expression</code> – where <code>key</code> and <code>value</code> can be any user defined identifiers,
and <code>expression</code> is the scope expression giving the collection to enumerate.</p>

<p>For example: <code>(name, age) in {'adam':10, 'amalie':12}</code>.</p></li>
</ul></li>
</ul>
</div>
<h2 id="Example">Example</h2>
<div class="example"><p>This example initializes the scope to a list of names and
then uses <code>ngRepeat</code> to display every person:
    <h4>Source</h4>
<div source-edit="" source-edit-deps="angular.js" source-edit-html="index.html-167" source-edit-css="" source-edit-js="" source-edit-unit="" source-edit-scenario="scenario.js-168"></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-167" ng-html-wrap=" angular.js"></pre>
<script type="text/ng-template" id="index.html-167">
        <div ng-init="friends = [{name:'John', age:25}, {name:'Mary', age:28}]">
          I have {{friends.length}} friends. They are:
          <ul>
            <li ng-repeat="friend in friends">
              [{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old.
            </li>
          </ul>
        </div>
      </script>
</div>
<div class="tab-pane" title="End to end test">
<pre class="prettyprint linenums" ng-set-text="scenario.js-168"></pre>
<script type="text/ng-template" id="scenario.js-168">
         it('should check ng-repeat', function() {
           var r = using('.doc-example-live').repeater('ul li');
           expect(r.count()).toBe(2);
           expect(r.row(0)).toEqual(["1","John","25"]);
           expect(r.row(1)).toEqual(["2","Mary","28"]);
         });
      </script>
</div>
</div><h4>Demo</h4>
<div class="well doc-example-live" ng-embed-app="" ng-set-html="index.html-167" ng-eval-javascript=""></div></div>
</div>
